home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / enter-2004-01.iso / files / maxima-5.9.0.exe / {app} / share / maxima / 5.9.0 / demo / cf.dem < prev    next >
Encoding:
Text File  |  2003-02-09  |  843 b   |  36 lines

  1. /* ===================================================================== */
  2. /* file: cf.dem    */
  3. /* the line cf(frac1+frac2) loops !!!!  */
  4. /* the 2 last lines gives erroneous results  */
  5. /* CONTINUED FRACTIONS. THIS IS GOOD STUFF. */
  6.  
  7. FRAC1:CF([1,2,3,4]);
  8. FRAC2:CF([2,3,4,5]);
  9. CFDISREP(FRAC1);
  10. CF(FRAC1+FRAC2);
  11. CFDISREP(%);
  12.  
  13.  
  14. cf(467288576/469097433);
  15. cfdisrep(%);
  16. ratsimp(%);
  17.  
  18.  
  19. /* CF can make the continued fraction expansion of SQRT(N) to
  20.    CFLENGTH terms. */
  21.  
  22. BLOCK([CFLENGTH:4],CFDISREP(CF(SQRT(3))));
  23. RATSIMP(%);
  24. %^2-3;
  25.  
  26. RATSQRT(N,CFLENGTH):=RATSIMP(CFDISREP(CF(SQRT(N))))$
  27.  
  28. RATSQRT(1776,25);
  29. %^2-1776;
  30.  
  31. /* With the primitives of SQRT and rational operations 
  32.    continued fraction expansions of many trancendental expressions
  33.    may be made in the classical way. */
  34.  
  35. /* ======================== END ==== END  ====================== */
  36.